import Taro from "@tarojs/taro";

const TOKEN_KEY = 'access_token';

const isLogin = () => {
  return !!Taro.getStorageSync(TOKEN_KEY);
};

export const getToken = () => {
  return Taro.getStorageSync(TOKEN_KEY);
};

const setToken = (token: string) => {
  console.log('setToken', token);
  Taro.setStorageSync(TOKEN_KEY, token)
};

const clearToken = () => {
  Taro.removeStorageSync(TOKEN_KEY);
};

export { isLogin, setToken, clearToken };
